package com.nineclock.approve.resolver;

import com.nineclock.approve.resolver.impl.ApprovalNodeResolver;
import com.nineclock.approve.resolver.impl.CCListNodeResolver;
import com.nineclock.approve.resolver.impl.EndNodeResolver;
import com.nineclock.approve.resolver.impl.StartNodeResolver;

import java.util.HashMap;
import java.util.Map;

/**
 * ProcessNodeResolver 工厂类
 */
public class ProcessNodeResolverFactory {
    
    private static Map<String, ProcessNodeResolver> instances = new HashMap<String, ProcessNodeResolver>();

    static {
        instances.put("start".toUpperCase(), new StartNodeResolver());
        instances.put("cclist".toUpperCase(), new CCListNodeResolver());
        instances.put("end".toUpperCase(), new EndNodeResolver());
        instances.put("approval".toUpperCase(), new ApprovalNodeResolver());
        //网关节点目前先不做考虑 ;
    }

    //根据type, 获取能够处理当前类型节点的 节点处理器
    public static ProcessNodeResolver getInstance(String type){
        return instances.get(type.toUpperCase());
    }

}